package com.heng.groupchat.model.vo;

import com.heng.groupchat.model.entity.ChatRecord;
import com.heng.groupchat.model.entity.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

@Data
public class ChatRecordVO implements Serializable {

    private String username;

    private String content;

    private Date time;

    @Serial
    private static final long serialVersionUID = 3961070308126196422L;

    public static ChatRecordVO objToVO(ChatRecord record) {
        if (record == null) {
            return null;
        }
        ChatRecordVO recordVO = new ChatRecordVO();
        BeanUtils.copyProperties(record, recordVO);
        recordVO.setTime(record.getCreateTime());
        return recordVO;
    }
}
